<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ include file="a.header.jsp" %>
<html>
<head>
<!-- /layuiproject/WebContent/4弹出层/tabs.jsp -->
<meta charset="UTF-8">
<title>Insert title here</title>
</head> 
<body>
选择牵头单位

<form class="layui-form" action="">	
	<input type="checkbox" lay-filter="c_all" name="" title="全选">
	<div class="layui-tab layui-tab-card">
	  <ul class="layui-tab-title">
	    <li class="layui-this">网站设置</li>
	    <li>用户管理</li>
	    <li>权限分配</li>
	    <li>商品管理</li>
	    <li>订单管理</li>
	  </ul>
	  <div class="layui-tab-content" style="height: 100px;">
	    <div class="layui-tab-item layui-show">
	    	<div class="layui-input-block" id="tt">
		      <input type="checkbox" name="like[write]" title="写作">
		      <input type="checkbox" name="like[read]" title="阅读" checked="">
		      <input type="checkbox" name="like[game]" title="游戏">		      
		    </div>
	    </div>
	    <div class="layui-tab-item">
	    	<div class="layui-input-block" id="t">
		      <input type="checkbox" name="4" title="4" class="checkboxitem">
		      <input type="checkbox" name="5" title="5" checked="" class="checkboxitem">
		      <input type="checkbox" name="6" title="6" class="checkboxitem">
		    </div>
	    </div>
	    <div class="layui-tab-item">3</div>
	    <div class="layui-tab-item">4</div>
	    <div class="layui-tab-item">5</div>
	    <div class="layui-tab-item">6</div>
	  </div>
	</div>
	<div class="layui-form-item">
		<div class="layui-input-block">
			<button class="layui-btn" lay-submit lay-filter="formData2">立即提交</button>
			<button type="reset" class="layui-btn layui-btn-primary">重置</button>
		</div>
	</div>
  </div>
  <input id="ok" value="ok">
</form>
<script>
//Demo
layui.use(['form','element'], function(){
  var form = layui.form,
   element = layui.element;
   $=layui.$;
   var str='';
  var method = function(){	  	  
	}
  
  layer.ready(function(){	   
	  method();
	});     
  
//   $("#id").click(function(){
// 	  alert(str);
//   })
	
  //监听提交
  form.on('checkbox(c_all)',function(data){
	  var a=data.elem.checked;
	  if(a == true){
		  $(".check").prop("checked",true);
		  form.render('checkbox');
	  }else{
		  $(".check").prop("checked",false);
		  form.render('checkbox');
	  }
	  
  });
  $("#ok").click(function(){
	  var check_arr = [];
      $('.checkboxitem:checked').each(function () {
          check_arr.push($(this).val());
      });
      console.log("选中的", check_arr)
	})
  form.on('submit(formData2)', function(data){
	  console.log(data.field);
	  str=data.field
	  var v=JSON.stringify(data.field);
	  var index=parent.layer.getFrameIndex(window.name);
	  
	  

	  parent.$("#text").val(v);
	  parent.layer.close(index);
//     layer.msg(JSON.stringify(data.field));
    	return false;
  });  
});
$("#id").click(function(){
	  alert("ok");
})
function callbackdata(){
	
}
</script>
</body>
</html>